package me.xhy.java.springboot3.webflux.projectreactor.s3projectreactor;

import reactor.core.publisher.Flux;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

public class S8Retry {
  public static void main(String[] args) throws InterruptedException {

    // delayElements 延迟发送元素；timeout 超时时间；retry 重试次数
    Flux.just(1, 2, 3, 4, 5, 6, 7, 8, 9)
        .log()
        .delayElements(Duration.ofSeconds(2))
        .log()
        .timeout(Duration.ofSeconds(1))
        .retry(3)
        .map(i -> i * 10)
        .log()
        .subscribe();


    TimeUnit.SECONDS.sleep(10);
  }
}
